import { message } from 'antd'
import { useEffect, useState } from 'react'
import HTTP from '../services/api'
import SelfTable from '../tools/selfTable'
import signApi from '../api/sign.api'




const signcloumns = [
    {
        dataIndex: 'username',
        title: '用户名  ',
        width: '50'
    },
    {
        dataIndex: 'nickname',
        title: '昵称',
        width: '50'
    },
    {
        dataIndex: 'status',
        title: '打卡状态',
        width: '50'
    },   {
        dataIndex: 'createdAt',
        title: '打开的时间  ',
        width: '50'
    }
    

]


function Case() {

    const [signInfo, setSignInfo] = useState([])
    const getAllSignInfo = async () => {
        let result = await HTTP({ method: 'get'}, signApi.WorkerSign)
        try {
            if (result.status) {
                setSignInfo(result.info)
            } else {
                message.error(result.msg)
            }
        } catch (error) {
            message.error('服务器异常')
        }
    }


    useEffect(() => {
        getAllSignInfo()
    }, [])

    return (
        <div>
            <SelfTable isshowHeader msg='工作人员查看打卡记录' columns={signcloumns} dataSource={signInfo}  keyid='sign_id'></SelfTable>
        </div>
    )
}


export default Case